<template>
	<app-page>
		<wd-config-provider :theme="theme">
			<view class="container">
				<view class="title">{{
					info.title
				}}</view>
				<view class="desc">时间：{{
					info.create_time
				}} {{
					info.time
				}}</view>
				<mp-html :content="html" />
			</view>
		</wd-config-provider>
	</app-page>
</template>

<script lang="ts">
	import { defineComponent, ref } from 'vue';

	import { onLoad } from '@dcloudio/uni-app';
	import { getTipsInfo } from "@/api/index"


	export default defineComponent({
		name: '',
		components: {},
		setup(props, ctx) {
			// 日间light、夜间dark主题
			const theme = ref('light');
			const html = ref("")
			const info = ref({
				title: "",
				date: "",
				time: "",
			});
			onLoad((params : any) => {
				if (params.id) {
					getTipsInfo({
						id: params.id
					}).then((res : any) => {
						html.value = res.desc;
						info.value = res;
						uni.setNavigationBarTitle({
							title: res.title
						})
					});
				}
			})
			return {
				theme,
				html,
				info,
			};
		}
	});
</script>

<style lang="less" scoped>
	.container {
		padding: 24rpx;

		.title {
			font-size: 32rpx;
			font-weight: bold;
			margin-bottom: 24rpx;
		}

		.desc {
			font-size: 28rpx;
			color: #666;
			margin-bottom: 16rpx;
		}
	}
</style>